﻿#include <iostream>
#include <thread>

#include <zmq.hpp>
#include <spdlog/spdlog.h>

int main()
{
	zmq::context_t ctx;
	zmq::socket_t responder = zmq::socket_t(ctx, ZMQ_REP);
	responder.bind("tcp://*:5555");

	while (true) {
		zmq::message_t request;
		responder.recv(&request);

		std::string request_str((char*)request.data(), request.size());
		spdlog::info("recv request: {}", request_str);
		std::this_thread::sleep_for(std::chrono::seconds(1));

		std::string respond = "zeromq";
		responder.send(respond.data(), respond.size());
	}
}
